package com.masterclient.app.businessmodule.minemodule.cash.adapter;

import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.masterclient.app.R;
import com.masterclient.app.businessmodule.minemodule.cash.bean.BalanceCashBean;
import com.eoner.baselibrary.utils.Utils;

/**
 * 作者：sean
 * 创建时间：2017/10/13 17:00
 * 功能说明：
 */

public class BalanceCashAdapter extends BaseQuickAdapter<BalanceCashBean.DataBean.ShItemsBean,BaseViewHolder>{
    public BalanceCashAdapter() {
        super(R.layout.item_view_cash_ti);
    }

    @Override
    protected void convert(BaseViewHolder helper, BalanceCashBean.DataBean.ShItemsBean item) {


        helper.setText(R.id.tv_ti_num,item.getSh_cash_no());
        helper.setText(R.id.tv_pay_num,item.getSh_acount());
        helper.setGone(R.id.tv_pay_num, !TextUtils.isEmpty(item.getSh_acount()));
        helper.setText(R.id.tv_time,item.getSh_create_at());
        helper.setText(R.id.tv_money,"-"+item.getSh_amount());
        helper.setText(R.id.tv_status,item.getSh_status());
        Utils.setDin(helper.getView(R.id.tv_money),mContext);
        TextView tvStatus = helper.getView(R.id.tv_status);
        if("失败".equals(item.getSh_status())||"已拒绝".equals(item.getSh_status())){
            tvStatus.setTextColor(0xffb1b1b1);
        }else {
            tvStatus.setTextColor(0xffDFAE73);
        }

        if("已打款".equals(item.getSh_status())){
            tvStatus.setVisibility(View.GONE);
        }else {
            tvStatus.setVisibility(View.VISIBLE);
        }

        if(helper.getLayoutPosition() == getData().size()-1){
            helper.getView(R.id.v_line).setVisibility(View.INVISIBLE);
        }
    }

}
